<style>
    #navbar {
        position: fixed;
        top: 0;
        left: 0;

        width: 100%;
        background-color: #767676;
    }
    nav ul {
        margin: 0px;
        padding: 5px 0px 5px 30px;
    }
    nav li {
        display: inline;
        margin-right: 20px;
    }
    a {
        text-decoration: none;
    }
</style>
<body>
<header>
    <h1>欢迎!</h1>
    <nav id="navbar">
        <ul>
            <li><a href="">网站首页</a></li>
            <li><a href="">联系我们</a></li>
        </ul>
    </nav>
</header>
<p>当导航条固定在浏览器窗口上时，我会上移。</p>
</body>